#ifndef LIGHTCONTROL_H
#define LIGHTCONTROL_H


#include <QDialog>
#include <QDesktopWidget>
#include <QString>
#include <QKeyEvent>
#include <QMouseEvent>
#include<QMessageBox>
#include<QByteArray>
#include<QPalette>
#include<QDebug>
#include<QTimer>
#include<QEvent>
#include<QByteArray>

#include "com.h"
#include "helpdialog.h"
#include "timingdialog.h"




namespace Ui {
    class LightControl;
}

class LightControl : public QDialog
{
    Q_OBJECT

public:
    explicit LightControl(QWidget *parent = 0);
    ~LightControl();
    void initStatus();
    void turnOnALL();
    void turnOffALL();

    void setMyCom(Win_QextSerialPort* pCom);
    void setCom(COM* paraCOM);
    TimingDialog* getTimingDialog();
    int  charToHex(char ch);

protected:
    void keyPressEvent(QKeyEvent *e);


private:
    TimingDialog *timingDialog;
    HelpDialog *helpDialog;
    Win_QextSerialPort *myCom;
    COM *com;
    Ui::LightControl *ui;
    bool status[6][10];
    QTimer *timer;
    void closeEvent(QCloseEvent *event);
    bool writeLock;


signals:
            void hideMe();
            void showMe();
            void allEvent();
private slots:
    void on_pushButton_clicked();
    void on_comboBox_activated(QString );
    void on_Btn5_9_clicked();
    void on_Btn5_8_clicked();
    void on_Btn5_7_clicked();
    void on_Btn5_6_clicked();
    void on_Btn5_5_clicked();
    void on_Btn5_4_clicked();
    void on_Btn5_3_clicked();
    void on_Btn5_2_clicked();
    void on_Btn5_1_clicked();
    void on_Btn4_6_clicked();
    void on_Btn4_5_clicked();
    void on_Btn4_4_clicked();
    void on_Btn4_3_clicked();
    void on_Btn4_2_clicked();
    void on_Btn4_1_clicked();
    void on_Btn3_7_clicked();
    void on_Btn3_6_clicked();
    void on_Btn3_5_clicked();
    void on_Btn3_4_clicked();
    void on_Btn3_3_clicked();
    void on_Btn3_2_clicked();
    void on_Btn3_1_clicked();
    void on_Btn2_7_clicked();
    void on_Btn2_6_clicked();
    void on_Btn2_5_clicked();
    void on_Btn2_3_clicked();
    void on_Btn2_4_clicked();
    void on_Btn2_2_clicked();
    void on_Btn2_1_clicked();
    void on_Btn1_6_clicked();
    void on_Btn1_5_clicked();
    void on_Btn1_4_clicked();
    void on_Btn1_2_clicked();
    void on_Btn1_3_clicked();
    void on_Btn1_1_clicked();
    void on_timingBtn_clicked();
    void on_turnOffAllBtn_clicked();
    void on_turnOnAllBtn_clicked();
    void checkStatus();
};

#endif // LIGHTCONTROL_H
